/*
 * Copyright (c) 2024 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import { ExtensionContext } from '../framework';
import { HMRouterPluginConfig } from './config/HMRouterPluginConfig';
import { RouterInfo } from './model';

/**
 * HMRouter Extension Context
 *
 * This interface extends the base ExtensionContext with HMRouter-specific
 * properties and methods.
 * It provides access to router-specific configuration,
 * the router map, and generated file paths.
 *
 * This context is used by all processors in the HMRouter extension to access
 * shared data and configuration settings specific to the HMRouter capability.
 */
export interface HMRouterExtensionContext extends ExtensionContext {
  /**
   * HMRouter plugin configuration
   *
   * Contains the parsed configuration from hmrouter_config.json,
   * including scan directories, template settings, and obfuscation options.
   */
  config: HMRouterPluginConfig;

  /**
   * Router map
   *
   * This array contains all the router information extracted from
   * @HMRouter annotations.
   * It is used to generate the router table
   * that'll be used at runtime.
   */
  routerMap: RouterInfo[];

  /**
   * Map of generated paths
   *
   * Stores the mapping between original source files and their
   * generated destination files.
   * This is used to track and manage
   * the files generated during the code generation phase.
   *
   * Key: Source path
   * Value: Generated path
   */
  generatedPaths: Map<string, string>;
}
